package com.ruoyi.project.domain.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.base.Field;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
@ApiModel("阶段字典配置表")
@TableName(value = "project_pay", autoResultMap = true)
public class ProjectPay extends Field {

    private static final long serialVersionUID = 1L;

    /** 表id */
    @TableField(fill = FieldFill.INSERT)
    @ApiModelProperty("id")
    @TableId
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /** 关联的阶段id */
    @Excel(name = "关联的阶段id")
    private Long phaseId;

    /** 付款公司 */
    @Excel(name = "付款公司")
    private String company;

    /** 付款公司 */
    @Excel(name = "付款公司")
    private String projectNo;

    /** 合同签订金额 */
    @Excel(name = "合同签订金额")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private BigDecimal totalAmount;

    /** 结算金额 */
    @Excel(name = "结算金额")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @TableField(exist = false)
    private BigDecimal settlementAmount;

    /** 付款百分比 */
    @Excel(name = "付款百分比")
    private Double percentage;

    /** 金额 通过合同签订金额和百分比计算得出 */
    @Excel(name = "金额 通过合同签订金额和百分比计算得出")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private BigDecimal amount;

    /** 附件 */
    @Excel(name = "附件")
    private String files;

    /** 附件 */
    @Excel(name = "附件名称")
    private String fileName;

    /** 发票编号 */
    @Excel(name = "发票编号")
    private String payNo;

    /** 备注 */
    @Excel(name = "备注")
    private String remark;


    /** 财务实收金额 */
    @Excel(name = "财务实收金额")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    private BigDecimal receivedAmount;


    /** 期票金额 */
    @Excel(name = "期票/承兑金额")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @TableField(exist = false)
    private BigDecimal promissoryNote;

    //到期日期
    @JsonFormat(pattern = "yyyy-MM-dd")
    @TableField(exist = false)
    private Date promissoryEndDate;


    /** 财务实收百分比 */
    @Excel(name = "财务实收百分比")
    private Double receivedPercentage;

    /** 操作员 */
    @Excel(name = "操作员")
    private String operator;

    //开票日期
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date financeDate;

    private String phaseName;

    //收款日期
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date payDate;

    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<String> saleIds;


    //fee的联合key

    @TableField(exist = false)
    private String housekeeperProject;

    @TableField(exist = false)
    private BigDecimal total;

    @TableField(exist = false)
    private String useType;

    @TableField(exist = false)
    private String mainType;

    @TableField(exist = false)
    private String submitDate;

    //绑定的销售总金额
    @TableField(exist = false)
    private String configTotal;

    @TableField(exist = false)
    private String currRow;  //1为实收金额小于销售总金额  2为实收金额大于销售总金额 3为相等


}
